// JavaScript Document
function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

//读取cookies 
function getCookie(c_name){
    var c_start,
        c_end,
        cookie;

    cookie = document.cookie;

    if(cookie.length > 0){
        c_start = cookie.indexOf(c_name + "");
        
        if(~c_start){
            c_start = c_start +c_name.length + 1;
            c_end = cookie.indexOf(";", c_start);

            if(!~c_end){
                c_end = cookie.length;
            }
            return unescape(cookie.substring(c_start, c_end));
        }

        return "";
    }
}

//删除cookies 
function delCookie(name) 
{ 
    var exp = new Date(); 
    exp.setTime(exp.getTime() - 1); 
    var cval=getCookie(name); 
    if(cval!=null) 
        document.cookie= name + "="+cval+";expires="+exp.toGMTString(); 
} 